// 统一导航栏组件样式
@use '../variables' as *;
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(248, 250, 252, 0.6) 100%);
    background-image: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(248, 250, 252, 0.6) 100%),
        url('/src/assets/pic/header_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    .header-content {
        max-width: 1200px;
        margin: 0 auto;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        position: relative;
    }
    .header-left {
        display: flex;
        align-items: center;
        gap: 20px;
        flex: 1;
    }
    .user-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        overflow: hidden;
        cursor: pointer;
        transition: transform $transition-normal;
        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        &:hover {
            transform: scale(1.05);
        }
    }
    .search-box {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin-left: -100px; // 向左偏移100px，避免挡住右边菜单
        .search-input {
            width: 300px;
             :deep(.el-input__wrapper) {
                border-radius: 20px;
                background: rgba(255, 255, 255, 0.8);
                border: 1px solid rgba($accent-color, 0.2);
                transition: all $transition-normal;
                &:hover {
                    border-color: rgba($accent-color, 0.4);
                }
                &.is-focus {
                    border-color: $accent-color;
                    box-shadow: 0 0 0 2px rgba($accent-color, 0.1);
                }
            }
        }
    }
    .nav-menu {
        display: flex;
        align-items: center;
        gap: 30px;
        flex: 1;
        justify-content: flex-end;
        .nav-link {
            color: $text-primary;
            text-decoration: none;
            font-size: 16px;
            font-weight: $font-medium;
            position: relative;
            transition: color $transition-normal;
            display: flex;
            align-items: center;
            gap: 4px;
            &:hover {
                color: $accent-color;
            }
            &.active {
                color: $accent-color;
                &::after {
                    content: '';
                    position: absolute;
                    bottom: -8px;
                    left: 0;
                    right: 0;
                    height: 2px;
                    background: $accent-color;
                    border-radius: 1px;
                }
            }
        }
    }
    .nav-dropdown {
        position: relative;
        cursor: pointer;
        &:hover .nav-link {
            color: $accent-color;
        }
        .nav-link {
            .el-icon {
                transition: transform $transition-normal;
                &.rotated {
                    transform: rotate(180deg);
                }
            }
        }
        .dropdown-menu {
            position: absolute;
            top: 100%;
            left: 0;
            background: white;
            border-radius: $radius-md;
            box-shadow: $shadow-lg;
            min-width: 120px;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-10px);
            transition: all $transition-normal;
            z-index: 1001;
            border: 1px solid $border-color;
            &.active {
                opacity: 1;
                visibility: visible;
                transform: translateY(0);
            }
            .dropdown-item {
                display: block;
                padding: $spacing-md $spacing-lg;
                color: $text-primary;
                text-decoration: none;
                transition: all $transition-normal;
                border-radius: $radius-sm;
                &:hover {
                    background: rgba($accent-color, 0.05);
                    color: $accent-color;
                }
                &.router-link-active {
                    background: rgba($accent-color, 0.1);
                    color: $accent-color;
                }
            }
        }
        // 管理后台链接特殊样式
        .admin-link {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white !important;
            padding: 8px 16px;
            border-radius: 20px;
            font-weight: 600;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
            transition: all $transition-normal;
            &:hover {
                color: white !important;
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
            }
            &.active {
                color: white !important;
                background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
                box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
                &::after {
                    display: none;
                }
            }
        }
    }
}

// 响应式设计
@media (max-width: 1200px) {
    .header {
        .search-box {
            width: 250px; // 稍微缩小搜索框宽度
        }
    }
}

@media (max-width: 1024px) {
    .header {
        .search-box {
            display: none; // 在中等屏幕下隐藏搜索框
        }
        .nav-menu {
            gap: 20px; // 减少导航项间距
        }
    }
}

@media (max-width: 768px) {
    .header {
        .header-content {
            padding: 0 15px;
        }
        .desktop-search {
            display: none;
        }
        .desktop-nav {
            display: none;
        }
    }
}

@media (max-width: 480px) {
    .header {
        .header-left {
            gap: 10px;
        }
    }
}